<include file="header" />
<div class="wraper" js="wapjs/meeting/js/outdoor">
    <div class="head clearfix">
        <a href="/meeting/MeetingService/index/account_id/{BEESCRM:$accountId}/status/1" class="iconfont icon-zuo"></a>
        <span class="head-name">会议服务详情</span>
    </div>

    <div class="lists tb-mode notop">
        <div class="tb-cell">
            <p>{BEESCRM:$meetingDetail.area_name}{BEESCRM:$meetingDetail.room_name}</p>
            <p class="text-12 text-gray">{BEESCRM:$meetingDetail.start_time|date='Y年m月d日', ###}   {BEESCRM:$meetingDetail.weekday}</p>
            <p class="text-12 text-gray">{BEESCRM:$meetingDetail.start_time|date='H:i', ###}-{BEESCRM:$meetingDetail.end_time|date='H:i', ###}</p>
        </div>
        <div class="tb-cell text-right">
            <if condition="$allComplete eq 2">
                <a href="javascript:void(0)" class="middle-btn bg-grey">全部完毕</a>
            <else/>
                <a href="javascript:void(0)" class="all-finish middle-btn bg-green">全部完毕</a>
            </if>
            <!--<a href="javascript:void(0)" class="all-finish middle-btn bg-green">全部完毕</a>-->
        </div>
    </div>
    <div class="lists">
        <div class="list-line tb-mode text-center">
            <div class="tb-cell tb-list">服务类型</div>
            <div class="tb-cell tb-list">服务内容</div>
            <div class="tb-cell tb-list">数量</div>
            <div class="tb-cell tb-list">操作</div>
        </div>
        <volist name="meetingServer" id="vo">
            <div class="list-line tb-mode text-center">
                <switch name="vo.service_type">
                    <case value="1"><div class="tb-cell tb-list">设备设施</div></case>
                    <case value="2"><div class="tb-cell tb-list">物业服务</div></case>
                    <case value="3"><div class="tb-cell tb-list">其他（绿植、桌椅）</div></case>
                </switch>
                <div class="tb-cell tb-list">{BEESCRM:$vo.device_name}</div>
                <div class="tb-cell tb-list">{BEESCRM:$vo.num}</div>
                <div class="tb-cell tb-list">
                    <if condition="$vo.complete eq 1">
                        <a href="javascript:void(0)" class="execute small-btn bg-green" data-sid="{BEESCRM:$vo.sid}">执行</a>
                    <elseif condition="$vo.complete eq 2" />
                        <a href="javascript:void(0)" class="small-btn bg-grey">已执行</a>
                    </if>
                </div>
            </div>
        </volist>
    </div>


    <div class="lists">
        <p>预约备注</p>
        <p class="text-12">{BEESCRM:$meetingDetail.remark_text}</p>
    </div>
</div>
<div class="layer-wraper">
    <div class="main">
        <p class="title">添加备注:</p>
        <textarea placeholder="请填写备注~" id="note_content" name="note_content"></textarea>
        <div class="pop-btn">
            <a href="javascript:void(0);" class="btn cancel">取消</a>
            <a href="javascript:void(0);" class="btn green-btn note_content"  data-basic_id="{BEESCRM:$basic_id}" data-account_id="{BEESCRM:$accountId}">确认</a>
        </div>
    </div>
</div>
<input type="hidden" id="basic_id" name="basic_id" value="{BEESCRM:$meetingDetail.basic_id}" />
<input type="hidden" id="account_id" name="account_id" value="{BEESCRM:$accountId}" />
<script type="text/javascript" src="/assets/public/seajs/sea.js"></script>
<script enter="publicjs/public" id="confnode" async="async" src="/assets/public/config.js"></script>
<script type="text/javascript" src="/assets/base/newCharging/modules/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
    $(".execute").click(function () {
        var sid = $(this).data('sid');
        var account_id = $("#account_id").val();
        var basic_id = $("#basic_id").val();
        $.ajax({
            url : '/meeting/MeetingService/exec/account_id/' + account_id,
            type : 'post',
            data : {sid : sid, basic_id : basic_id},
            dataType : 'json',
            success : function (result) {
                if(result.status == 'S'){
                    if (result.errcode == 1){
                        $(".layer-wraper").show();
                    }else if(result.errcode == 2){
                        fm.alert('执行成功！');
                        setTimeout(function () {
                            location.href = '/meeting/MeetingService/detail/account_id/' + account_id + '/basic_id/' + basic_id + '/status/1';
                        },2000);
                    }
                }else if(result.status == 'F'){
                    fm.alert('执行失败！');
                    setTimeout(function () {
                        location.href = '/meeting/MeetingService/detail/account_id/' + account_id + '/basic_id/' + basic_id + '/status/1';
                    },2000);
                }
            }
        });
    })
    
    $(".all-finish").click(function () {
        $(".layer-wraper").show();
    })

    $(".cancel").click(function () {
        $("#note_content").val('');
        $(".layer-wraper").hide();
    })
    
    $(".note_content").click(function(){
        var account_id = $("#account_id").val();
        var basic_id = $("#basic_id").val();
        var note_content = $("#note_content").val();
        $.ajax({
            url : '/meeting/MeetingService/batchExec/account_id/' + account_id,
            type : 'post',
            data : {basic_id : basic_id, note_content : note_content},
            dataType : 'json',
            success : function (result) {
                if(result.status == 'S'){
                    fm.alert('执行成功！');
                    $(".layer-wraper").hide();
                    $(".all-finish").addClass('bg-grey').removeClass('bg-green');
                    setTimeout(function () {
                        location.href = '/meeting/MeetingService/detail/account_id/' + account_id + '/basic_id/' + basic_id + '/status/2';
                    },2000);
                }else if(result.status == 'F'){
                    fm.alert('执行失败！');
                    $(".layer-wraper").hide();
                    setTimeout(function () {
                        location.href = '/meeting/MeetingService/detail/account_id/' + account_id + '/basic_id/' + basic_id + '/status/2';
                    },2000);
                }
            }
        });
    })
</script>
</body>
</html>